/*
package com.chengzhi.route;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

*/
/**
 * @author ruanchengzhi
 * @description: db路由
 * @date 2019/9/29 9:46
 *//*

@Component
public class PropertiesDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    private final static String sql = "select * from zuul_route where enable = true";

    public Map<String, ZuulProperties.ZuulRoute> getPropertis() {
        Map<String, ZuulProperties.ZuulRoute> routeMap = new LinkedHashMap<>();
        List<ZuulProperties.ZuulRoute> routeList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZuulProperties.ZuulRoute.class));
        for (ZuulProperties.ZuulRoute zuulRoute : routeList) {
            if (StringUtils.isEmpty(zuulRoute.getPath())) {
            }
            ZuulProperties.ZuulRoute route = new ZuulProperties.ZuulRoute();
            BeanUtils.copyProperties(zuulRoute, route);
            routeMap.put(route.getPath(), route);
        }
        return routeMap;
    }

}
*/
